package com.shycloud.mido.organ.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.organ.api.entity.MemberEntity;
import com.shycloud.mido.organ.api.entity.SysRole;
import com.shycloud.mido.organ.api.vo.OrgMemberVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 会员MAPPER
 *
 * @author yyy
 * @date 2019-09-24 10:06:58
 */

public interface MemberMapper  extends BaseMapper<MemberEntity> {
	IPage<OrgMemberVO> selectUserAndRole(Page<OrgMemberVO> page, @Param("query") OrgMemberVO orgMemberVO);

	List<SysRole> selectRoles(@Param("userId") String userId);

	Map<String, String> getOldMemberByPhone(@Param("phone") String phone);
	Map<String, String> getOldStudioByMemberId(@Param("memberId") String memberId);
	Map<String, String> getOldTeacherByMemberId(@Param("memberId") String memberId);
	List<Map<String, String>> getOldStudentsByTeacherId(@Param("teacherId") String teacherId);
	Map<String, String> getOldMemberById(@Param("memberId") String memberId);
	List<Map<String, String>> getOldStudioTeacherPhoneList();

	List<Map<String, String>> getOldMemberRole(@Param("id") String id);

	String getOldMemberIdByPhone(@Param("phone") String phone);
	List<Map<String, String>> getOldHardwareByMemberId(@Param("memberId") String memberId);
	List<Map<String, String>> getOldMemberList();
	List<Map<String, String>> getOldMemberRepeat();

	void deleteHardNew(@Param("newMemberId") String newMemberId);
	@SqlParser(filter=true)
	void updateHardOldToNew(@Param("newMemberId") String newMemberId, @Param("oldUsername") String oldUsername);
	void deleteVipNew(@Param("newMemberId") String newMemberId);
	@SqlParser(filter=true)
	void updateVipOldToNew(@Param("newMemberId") String newMemberId, @Param("oldUsername") String oldUsername);
}
